<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>主页</title>
    <!--icheck-->
    <link rel="shortcut icon" href="/images/favicon.ico"  type="image/x-icon">
    <link href="/js/iCheck/skins/minimal/minimal.css" rel="stylesheet">
    <link href="/js/iCheck/skins/square/square.css" rel="stylesheet">
    <link href="/js/iCheck/skins/square/red.css" rel="stylesheet">
    <link href="/js/iCheck/skins/square/blue.css" rel="stylesheet">
    <!--dashboard calendar-->
    <link href="/css/clndr.css" rel="stylesheet">
    <!--Morris Chart CSS -->
    <link rel="stylesheet" href="/js/morris-chart/morris.css">
    <!--common-->
    <link href="/css/style.css" rel="stylesheet">
    <link href="/css/style-responsive.css" rel="stylesheet">
    <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
    <script src="/js/html5shiv.js"></script>
    <script src="/js/respond.min.js"></script>
    <![endif]-->
</head>

<body class="sticky-header">

<!--左侧开始-->
<div th:replace="~{admin/commons/common :: commonleft}"></div>
<!--左侧结束-->


<!-- 主页面开始-->
<div class="main-content" >

    <!--头部开始-->
    <div th:replace="~{admin/commons/common :: commonheader}"></div>
    <!--头部结束-->

    <!-- page heading start-->
    <div class="page-heading">
        <h3>
            首页
        </h3>
        <ul class="breadcrumb">
            <li class="active">数据总览</li>
        </ul>
    </div>
    <!-- page heading end-->

    <!--body wrapper start-->
    <div class="wrapper">
        <div class="row">
            <div class="col-md-6">
                <!--statistics start-->
                <div class="row state-overview">
                    <div class="col-md-6 col-xs-12 col-sm-6">
                        <div class="panel purple">
                            <div class="symbol">
                                <i class="fa fa-bars"></i>
                            </div>
                            <div class="state-value">
                                <div class="value" th:text="${paperCount}"></div>
                                <div class="title">试卷量</div>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-6 col-xs-12 col-sm-6">
                        <div class="panel red">
                            <div class="symbol">
                                <i class="fa fa-tags"></i>
                            </div>
                            <div class="state-value">
                                <div class="value" th:text="${questionTotal}"></div>
                                <div class="title">题目数</div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row state-overview">
                    <div class="col-md-6 col-xs-12 col-sm-6">
                        <div class="panel blue">
                            <div class="symbol">
                                <i class="fa fa-check"></i>
                            </div>
                            <div class="state-value">
                                <div class="value" th:text="${finishedTotal}"></div>
                                <div class="title">完成量</div>
                            </div>
                        </div>
                    </div>
                    <div class="col-md-6 col-xs-12 col-sm-6">
                        <div class="panel green">
                            <div class="symbol">
                                <i class="fa fa-users"></i>
                            </div>
                            <div class="state-value">
                                <div class="value" th:text="${userCount}"></div>
                                <div class="title">用户量</div>
                            </div>
                        </div>
                    </div>
                </div>
                <!--statistics end-->
            </div>
            <div class="col-md-6">

                <div class="panel green-box">
                    <div class="panel-body extra-pad">
                        <div class="row">
                            <div class="col-sm-6 col-xs-6">
                                <div class="knob">
                                        <span class="chart" th:data-percent="${singleRate}">
                                            <span class="percent" th:text="'单选'+${singleRate}+'%'"></span>
                                        </span>
                                </div>
                            </div>
                            <div class="col-sm-6 col-xs-6">
                                <div class="knob">
                                        <span class="chart" th:data-percent="${moreRate}">
                                            <span class="percent" th:text="'多选'+${moreRate}+'%'"></span>
                                        </span>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-md-6">

                <div class="panel green-box">
                    <div class="panel-body extra-pad">
                        <div class="row">
                            <div class="col-sm-6 col-xs-6">
                                <div class="knob">
                                        <span class="chart" th:data-percent="${judgeRate}">
                                            <span class="percent" th:text="'判断'+${judgeRate}+'%'"></span>
                                        </span>
                                </div>
                            </div>
                            <div class="col-sm-6 col-xs-6">
                                <div class="knob">
                                        <span class="chart" th:data-percent="${statusRate}">
                                            <span class="percent" th:text="'可用'+${statusRate}+'%'"></span>
                                        </span>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!--body wrapper end-->

    <!--footer section start-->

    <footer>
            2022 &copy;<a href="https://www.pdsu.edu.cn/"  target="_blank">平顶山学院软件应用双创实验室提供技术支持</a>
    </footer>
    <!--footer section end-->


</div>
<!-- 主页面结束-->


<div th:replace="~{admin/commons/common :: commonupdatePwd}"></div>


<!-- Placed js at the end of the document so the pages load faster -->
<script src="/js/jquery-1.10.2.min.js"></script>
<script src="/js/jquery-ui-1.9.2.custom.min.js"></script>
<script src="/js/jquery-migrate-1.2.1.min.js"></script>
<script src="/js/bootstrap.min.js"></script>
<script src="/js/modernizr.min.js"></script>
<script src="/js/jquery.nicescroll.js"></script>

<!--easy pie chart-->
<script src="/js/easypiechart/jquery.easypiechart.js"></script>
<script src="/js/easypiechart/easypiechart-init.js"></script>

<!--Sparkline Chart-->
<script src="/js/sparkline/jquery.sparkline.js"></script>
<script src="/js/sparkline/sparkline-init.js"></script>

<!--icheck -->
<script src="/js/iCheck/jquery.icheck.js"></script>
<script src="/js/icheck-init.js"></script>

<!-- jQuery Flot Chart-->
<script src="/js/flot-chart/jquery.flot.js"></script>
<script src="/js/flot-chart/jquery.flot.tooltip.js"></script>
<script src="/js/flot-chart/jquery.flot.resize.js"></script>


<!--Morris Chart-->
<script src="/js/morris-chart/morris.js"></script>
<script src="/js/morris-chart/raphael-min.js"></script>

<!--Calendar-->
<script src="/js/calendar/clndr.js"></script>
<script src="/js/calendar/evnt.calendar.init.js"></script>
<script src="/js/calendar/moment-2.2.1.js"></script>

<!--common scripts for all pages-->
<script src="/js/scripts.js"></script>

<!--Dashboard Charts-->
<script src="/js/dashboard-chart-init.js"></script>
<!-- END JAVASCRIPTS -->
<script>

    // 修改密码
    $("#pwd_btn").click(function() {
        $("#pwd_btn").blur();
        if (confirm("是否确定修改?")){
            var submit = true;
            var oldPwd = $("#oldPwd").val(); //原始密码
            var newPwd = $("#newPwd").val(); //新密码1
            var newPwd2 = $("#newPwd2").val(); //新密码2

            if ((oldPwd && newPwd && newPwd2) == '') {
                $("#tip").html("密码不能为空");
                $("#tip").show();
                submit = false;
            }
            if(submit){
                $.ajax({
                    type:"post",
                    url:"/admin/updatePwd",
                    data: JSON.stringify({
                        oldPwd : oldPwd,
                        newPwd : newPwd,
                        newPwd2 : newPwd2
                    }),
                    contentType: "application/json;charset=utf-8",
                    //定义回调响应的数据格式为JSON字符串，该属性可以省略
                    dataType: "json",
                    success:function (data){
                        if(data.code == 200 ){
                            $("#tip").hide();
                            $("#pwd_form").submit();
                            alert("修改成功，请重新登录!")
                            window.location.href = "/user/logout"
                        }else if(data.code != 200){
                            $("#tip").html(data.info);
                            $("#tip").show();
                        }
                    }
                });
            }
        }
    });
    jQuery(document).ready(function() {
        EditableTable.init();
        document.getElementById("menu1").className="menu-list nav-active";
    });
</script>
</body>
</html>